package uk.ac.aber.Blockmation;

import javax.swing.JButton;
import javax.swing.JToolBar;

import uk.ac.aber.Blockmation.Actions.ActionCopyFrame;
import uk.ac.aber.Blockmation.Actions.ActionDeleteFrame;
import uk.ac.aber.Blockmation.Actions.ActionInsertFrame;
import uk.ac.aber.Blockmation.Actions.ActionLoadProject;
import uk.ac.aber.Blockmation.Actions.ActionNewProject;
import uk.ac.aber.Blockmation.Actions.ActionPasteFrame;
import uk.ac.aber.Blockmation.Actions.ActionSaveProject;
import uk.ac.aber.Blockmation.Actions.ActionShowViewer;
import uk.ac.aber.Blockmation.Actions.ActionToggleGrid;

/**
 * Constructs the ToolBar
 * @author tom
 */

public class OurToolBar extends JToolBar {
    
    private MainFrame mainFrame;
    
    private JButton insertNew;
    private JButton copyFrame;
    private JButton pasteFrame;
    private JButton deleteFrame;
    private JButton saveProject;
    private JButton loadProject;
    private JButton toggleGrid;
    private JButton showViewer;
    private JButton openProject;

    public OurToolBar(MainFrame mainFrame) {
        
        super();
        this.mainFrame = mainFrame;
        ////    creates new toolBar
        //this.setFloatable(false); //locks in place
        this.setRollover(true);  // better looking


        ///customizes bar
        //setPreferredSize (new Dimension(450, 130));
        addButtons(this);
        
    }
    	
	
    ////creating buttons for the toolBar
    protected void addButtons(JToolBar toolBar) {

            ActionInsertFrame actionInsertFrame = new ActionInsertFrame (mainFrame);
            actionInsertFrame.setImage();
            insertNew = new JButton (actionInsertFrame);

            ActionCopyFrame actionCopyFrame = new ActionCopyFrame (mainFrame);
            actionCopyFrame.setImage();
            copyFrame = new JButton (actionCopyFrame);

            ActionPasteFrame actionPasteFrame = new ActionPasteFrame (mainFrame);
            actionPasteFrame.setImage();
            pasteFrame = new JButton (actionPasteFrame);

            ActionDeleteFrame actionDeleteFrame = new ActionDeleteFrame (mainFrame);
            actionDeleteFrame.setImage();
            deleteFrame = new JButton (actionDeleteFrame);

            ActionSaveProject actionSaveProject = new ActionSaveProject(mainFrame);
            actionSaveProject.setImage();
            saveProject = new JButton (actionSaveProject);

            ActionLoadProject actionLoadProject = new ActionLoadProject (mainFrame);
            actionLoadProject.setImage();
            loadProject = new JButton (actionLoadProject);

            ActionNewProject actionNewProject = new ActionNewProject(mainFrame);
            actionNewProject.setImage();
            openProject = new JButton (actionNewProject);

            ActionToggleGrid actionToggleGrid = new ActionToggleGrid (mainFrame);
            actionToggleGrid.setImage();
            toggleGrid = new JButton (actionToggleGrid);

            ActionShowViewer actionShowViewer = new ActionShowViewer (mainFrame);
            actionShowViewer.setImage();
            showViewer = new JButton (actionShowViewer);

            ///adding to toolBar

            this.add(saveProject);
            this.add(loadProject);
            this.add(openProject);
            this.add(insertNew);
            this.add(copyFrame);
            this.add(pasteFrame);
            this.add(deleteFrame);
            this.add(toggleGrid);
            this.add(showViewer);

    }///end of creating buttons

} ///end of class



